# !/usr/bin/python
# -*-coding: utf-8-*-
# FileName: Accessory.py

import time
import thread


class CYCLE_CONTENT:
	'''周期打印指定文字符

		start( cont, cycletime )启动 cont:打印字符 cycletime:周期
		stop()停止
		默认周期1秒，字符"."。'''
	def __init__( self ):
		self.sw = False

	def run( self, cont, cycletime ):
		while( self.sw == True ):
			time.sleep( cycletime )
			print( cont ),

	def start( self, cont='.', cycletime=1 ):
		self.sw = True
		thread.start_new_thread( self.run, ( cont, cycletime ) )

	def stop( self ):
		self.sw = False


print( CYCLE_CONTENT.__doc__ )
dot = CYCLE_CONTENT()
dot.start()
time.sleep( 2 )
dot.stop()

star = CYCLE_CONTENT()
star.start( '*', 1 )
time.sleep( 2 )
star.stop()

star = CYCLE_CONTENT()
star.start( cycletime=0.5 )
time.sleep( 2 )
star.stop()